{include file="index/head" /}
<style type="text/css">
.process{ padding:12px; overflow:hidden;}
.process .processbox{ position:relative; height:300px; padding-top:40px;}
.process .processbox #prosbfb{ position:absolute; top:0;}
.process .processbox #prosbfb img{width:15px; height:15px; vertical-align: middle;}
.process .processbar{height:15px; width:100%; overflow:hidden; position:absolute; top:23px; left:0; background:#ddd;  border-radius:3px;}
.process .processbar span{  background-image: linear-gradient(45deg, #0d93f0, #0eb9f8); top:0; display:block; position:absolute; left:0; width:0%; height:100%; }
.process .processbar span i{ position:absolute; top:-25px; right:0px; color:#333; font-size:15px;}
.process .processfina{ overflow-y:auto; height:100%;}
.process .processfina li{ line-height:24px; font-size:14px;}
</style>
<div class="process">
    <div class="processbox">
    <p id="prosbfb">生成中请稍等...<img src="/public/admin/images/loading.gif"></p>
    <div class="processbar"><span></span></div>
    <ul class="processfina">       
    </ul>
    </div>
</div>
<script src="/public/admin/js/ax.js"></script>
<script type="text/javascript">
var timer = setInterval("send()",10);	 
var p = 1;
var total = 0;
var pagecid = 0;
var cid = '{$cid}';
var p2 = 1;
function send(){
	var ajax = new $ax("{$url}", function(data){		
		if(data.status == 0){			
			clearInterval(timer);		
			$("#prosbfb").html('生成进度：100%');		
			$(".processbar span").animate({'width':'100%'},300);			
		}else{
			$("#prosbfb").html('生成进度：'+data.process+'%');
			$(".processbar span").animate({'width':data.process+'%'},300);
			if(typeof(data.data)!='undefined'){
				var arr = data.data;
				for(var i = 0; i < arr.length; i++){
					$(".processfina").prepend('<li>'+arr[i]+'</li>');
				}	
			}
			//循环分页实现
			if(typeof(data.totalpage)!='undefined'){
				if(data.totalpage>0){
					total 	 = data.totalpage;
					pagecid  = data.pagecid;
					if(typeof(data.startpage)!='undefined'){p = 2;} //第一次开始分页page从2页开始
				}else{
					total = 0;
					p2++;
					p = p2;
				}
			}	
		}
	});	
	ajax.set('process_page',p++);
	ajax.set('process_nid','{$nid}');
	ajax.set('process_cid',cid);
	ajax.set('process_pagecid',pagecid);
	ajax.set('process_total',total);
	ajax.set('htmlpath','{$htmlpath}');
	ajax.start();
}
</script>